<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>用户列表</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" href="__PUBLIC__/X-admin/css/x-admin.css" media="all">
        <style>
          .layui-layer-content{
              padding:15px;
              letter-spacing:2px;
          }
        </style>
    </head>
    <body>
        <div class="x-nav">
            <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新"><i class="layui-icon" style="line-height:29px">ဂ</i> <i class="layui-icon" style="line-height:30px">刷新</i></a>
        </div>
        <xblock><button class="layui-btn" onclick="admin_add('添加用户','__URL__/news','','600')"><i class="layui-icon"></i>添加</button></xblock>
        <div class="x-body">
            <table class="layui-table">
                <thead>
                    <tr>
                        <th>学员姓名</th>                         
                        <th>所在班级</th>
                        <th>类型</th>
                        <th>申请时间</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                </thead>

                <tbody>
                    <foreach name="list" item="row" >
                        <tr>
                           <td>{$row['name']}</td>
                           <td>{$row['oldcs']}</td>

                           <!-- 显示状态信息 -->
                           <td>
                                {$row['typename']}
                           </td>
                           <td>{$row['sendtime']}</td>

                           <!-- 显示处理状态信息 -->
                           <td>
                                <span class="layui-btn layui-btn-{$row['color']} layui-btn-mini">{$row['statusname']}</span>
                           </td>
                           <td>
                                <a href="javascript:;" class="ml-5" onclick="fun({$row['descid']})" style="text-decoration:none"><i class="layui-icon" style="font-size:30px;color:#F7B824" >&#xe60b;</i></a>
                                <a title="提交" href="javascript:;"  onclick="admin_pass({$row['status']},{$row['id']})" style="text-decoration:none"><i class="layui-icon" style="font-size:30px;color:#009688" >&#xe616;</i></a>
                               
                                <a href="javascript:;" onclick="admin_del({$row['status']},{$row['id']})" style="text-decoration:none"><i class="layui-icon" style="font-size:30px;color:#FF5722" >&#x1007;</i></a>
                               <!-- <button class="layui-btn " ><i class="layui-icon" style="font-size:23px">&#xe60b;</i> </button> -->
                           </td>
                           <td style="display:none;" id="{$row['descid']}">{$row['desc']}</td>
                        </tr>
                    </foreach>
                </tbody>
            </table>
            <div class="total">共{$total}条数据</div>
            <div id="pages"></div>

        </div>
        <script src="__PUBLIC__/X-admin/lib/layui/layui.js" charset="utf-8"></script>
        <script src="__PUBLIC__/X-admin/js/x-layui.js" charset="utf-8"></script>
        <script>
            layui.use(['laydate','element','laypage','layer','form'], function(){
                $ = layui.jquery;//jquery
              layer = layui.layer;//弹出层
              var form = layui.form(); //只有执行了这一步，部分表单元素才会修饰成功
              laypage = layui.laypage;

              laypage({
                cont:'pages', //当前id类
                curr:{$curr}, //当前页
                groups:5,       //只显示5个按钮后面用...
                pages:{$page},  //总的显示多少页
                skip:true,
                jump:function(obj,first){
                    var url = window.location.href;
                    if(!first){
                        window.location.href=url+"/p/"+obj.curr+".html";
                    }
                }
              });
            });

            //显示信息
            function fun(b) {
              layer.open({
                type: 1,
                skin: 'layui-layer-molv',
                closeBtn: 2,
                area: ['360px', '200px'],
                btn: '关闭',
                title: "查看原因",
                content: $('#'+b).html()
              });
            }

            //通过
            function admin_pass(status,id){
                layer.confirm('是否通过？',function(index){
                    $.post('__URL__/update',{status:status,id:id},function(data){
                        // alert(data);
                        if(data==1){  
                          layer.alert("修改成功",{icon:1,time:2000},function(){
                                location.replace(location.href);  
                          })    
                        }else{
                            layer.msg("修改失败",{icon:2});
                        }
                    });
                });
            }

            function admin_del(status,id){
              layer.confirm('是否拒绝信息？',function(index){
                $.post('__URL__/updates',{status:status,id:id},function(data){
                    if(data==1){  
                       layer.alert("拒绝成功",{icon:1,time:2000},function(){
                            location.replace(location.href);  
                       })                         
                    }else{
                        layer.msg("拒绝失败",{icon:2});
                    }
                });
              });
            }
             /*添加*/

            
            function admin_add(title,url,w,h){
                x_admin_show(title,url,w,h);
            }

            // 刷新页面
           function reload() {
               location.replace(location.href);
           }
            </script>
    </body>
</html>